<template>
  <div class="project-confirm-container">
    <el-card>
      <p>此为大模型分析结果</p>
    </el-card>

    <!-- 复杂度输入部分 -->
    <el-table :data="complexityData" style="width: 100%; margin-top: 20px">
      <el-table-column prop="name" label="复杂度" width="150"></el-table-column>
      <el-table-column label="值">
        <template slot-scope="scope">
          <el-input v-model="scope.row.value" placeholder="请输入"></el-input>
        </template>
      </el-table-column>
    </el-table>

    <!-- 二选一的下拉框 -->
    <el-select v-model="selectedOption" placeholder="请选择" style="width: 200px; margin-top: 20px">
      <el-option label="通用系统调整因子法" value="GSC"></el-option>
      <el-option label="需求变更调整因子法" value="VAF"></el-option>
    </el-select>

    <!-- GSC综合系统特征表格 -->
    <el-table v-if="selectedOption === 'GSC'" :data="gscData" style="width: 100%; margin-top: 20px">
      <el-table-column prop="name" label="项" width="250"></el-table-column>
      <el-table-column prop="value" label="值"></el-table-column>
    </el-table>

    <!-- VAF调整系数值表格 -->
    <div v-if="selectedOption === 'VAF'">
      <!-- 五选一的下拉框 -->
      <el-select v-model="selectedSection" placeholder="请选择" style="width: 200px; margin-top: 20px">
        <el-option label="项目立项" value="initiation"></el-option>
        <el-option label="项目招标" value="bidding"></el-option>
        <el-option label="项目早期" value="early"></el-option>
        <el-option label="项目中期" value="midterm"></el-option>
        <el-option label="项目完成" value="completion"></el-option>
      </el-select>
      <el-table :data="vafData" style="width: 100%; margin-top: 20px">
        <el-table-column prop="name" label="项" width="250"></el-table-column>
        <el-table-column label="值">
          <template slot-scope="scope">
            <span v-if="isVisible(scope.row.name)">{{ scope.row.value }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-button type="primary" style="margin-top: 20px" @click="proceedToNextStep">
      确认
    </el-button>
  </div>
</template>

<script>
export default {
  name: 'ProjectConfirm',
  data() {
    return {
      complexityData: [
        { name: 'EO复杂度', value: '' },
        { name: 'EI复杂度', value: '' },
        { name: 'EQ复杂度', value: '' },
        { name: 'ILF复杂度', value: '' },
        { name: 'EIF复杂度', value: '' },
      ],
      selectedOption: '', // 用于存储下拉框选择的值
      selectedSection: '', // 用于存储VAF的阶段选择
      gscData: [
        { name: 'EI数量', value: 0 },
        { name: 'EO数量', value: 0 },
        { name: 'EQ数量', value: 0 },
        { name: 'ILF数量', value: 0 },
        { name: 'EIF数量', value: 0 },
        { name: '数据通信', value: 0 },
        { name: '分布式数据处理', value: 0 },
        { name: '性能', value: 0 },
        { name: '重度配置', value: 0 },
        { name: '处理速率', value: 0 },
        { name: '在线数据输入', value: 0 },
        { name: '最终用户使用效率', value: 0 },
        { name: '在线升级', value: 0 },
        { name: '复杂处理', value: 0 },
        { name: '可重用性', value: 0 },
        { name: '易安装性', value: 0 },
        { name: '易操作性', value: 0 },
        { name: '多场所', value: 0 },
        { name: '支持变更', value: 0 },
      ],
      vafData: [
        { name: 'EI数量', value: 0 },
        { name: 'EO数量', value: 0 },
        { name: 'EQ数量', value: 0 },
        { name: 'ILF数量', value: 0 },
        { name: 'EIF数量', value: 0 },
        { name: '项目立项', value: 2.00, key: 'initiation' },
        { name: '项目招标', value: 1.50, key: 'bidding' },
        { name: '项目早期', value: 1.26, key: 'early' },
        { name: '项目中期', value: 1.26, key: 'midterm' },
        { name: '项目完成', value: 1.00, key: 'completion' },
      ],
    };
  },
  methods: {
    proceedToNextStep() {
      this.$message.success('进入下一步');
      this.$router.push({ name: 'ResultShow' }); // 确保路由名称正确
    },
    isVisible(name) {
      // 判断当前行是否可见
      const sectionMap = {
        initiation: '项目立项',
        bidding: '项目招标',
        early: '项目早期',
        midterm: '项目中期',
        completion: '项目完成',
      };
      return sectionMap[this.selectedSection] === name;
    },
  },
};
</script>

<style scoped>
.project-confirm-container {
  padding: 20px;
}
</style>
